import Vue from "vue";
import dayjs from "dayjs";
const filters = {
  // 日期格式化
  formatDate(value, pattern = "YYYY/MM/DD") {
    return dayjs(value).format(pattern);
  },
};
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});
/*
  Vue.filter(key, filters[key])
  等于下面这个
  Vue.filter("msgFormat", function(msg, arg, arg2) {
    return msg.replace(/魔镜/g, arg + arg2);
  });
*/
